package com.mooc.house.web.controller;

import com.mooc.house.biz.service.RecommendService;
import com.mooc.house.common.model.House;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * Created by 敲代码的卡卡罗特
 * on 2018/4/27 22:42.
 */
@Controller
public class HomepageController {
    @Autowired
    private RecommendService recommendService;

    @RequestMapping("")
    public String index(ModelMap modelMap){
        return "redirect:/index";
    }
    @RequestMapping("index")
    public String accountsRegister(ModelMap modelMap){
        List<House> houses =  recommendService.getLastest();
        modelMap.put("recomHouses", houses);
        return "/homepage/index";
    }
}
